package com.ieasy.module.system.web.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ieasy.basic.model.DataGrid;
import com.ieasy.basic.model.Msg;
import com.ieasy.basic.util.cons.Const;
import com.ieasy.module.common.web.action.BaseController;
import com.ieasy.module.system.service.IIntellectualService;
import com.ieasy.module.system.web.form.IntellEctualForm;
import com.ieasy.module.system.web.form.NoticeForm;

@Controller
@RequestMapping("/admin/system/intell")
public class IntellAction extends BaseController {

	@Autowired
	private IIntellectualService intellService ;
	
	@RequestMapping("/intell_main_UI.do")
	public String intell_main_UI(){
		return  Const.SYSTEM + "intell_main_UI" ;
	}
	
	@RequestMapping("/intell_view_main_UI.do")
	public String intell_view_main_UI(){
		return  Const.SYSTEM + "intell_view_main_UI" ;
	}
	
	@RequestMapping("/intell_form_UI.do")
	public String notice_form_UI(NoticeForm form, Model mode){
		if(null != form.getId() && !"".equals(form.getId())) {
			mode.addAttribute("id", form.getId()) ;
		}
		return Const.SYSTEM + "intell_form_UI" ;
	}
	
	@RequestMapping("/intell_open_UI.do")
	public String info_open_UI(IntellEctualForm form, Model mode){
		if(null != form.getId() && !"".equals(form.getId())) {
			mode.addAttribute("id", form.getId()) ;
		}
		return Const.SYSTEM + "intell_view_open_UI" ;
	}
	
	@RequestMapping("/get.do")
	@ResponseBody
	public IntellEctualForm get(IntellEctualForm form){
		return this.intellService.get(form) ;
	}
	
	@RequestMapping("/add.do")
	@ResponseBody
	public Msg add(IntellEctualForm form){
		return this.intellService.add(form) ;
	}
	
	@RequestMapping("/update.do")
	@ResponseBody
	public Msg edit(IntellEctualForm form){
		return this.intellService.update(form) ;
	}
	
	@RequestMapping("/delete.do")
	@ResponseBody
	public Msg delete(IntellEctualForm form){
		return this.intellService.delete(form) ;
	}
	
	@RequestMapping("/datagrid.do")
	@ResponseBody
	public DataGrid datagrid(IntellEctualForm form){
		return this.intellService.datagrid(form) ;
	}
	
	@RequestMapping("/view_datagrid.do")
	@ResponseBody
	public DataGrid view_datagrid(IntellEctualForm form){
		return this.intellService.datagridByRoleView(form) ;
	}
	
}
